<template>
  <div class="container" v-if="result.length > 0">
    <div class="left">
      <div>
        <div>{{ result[0].field_name }}</div>
        <div>
          <span>{{ result[0].field_value }}</span>
          {{ result[0].unit }}
        </div>
      </div>
    </div>
    <div class="right">
      <div v-for="(item, index) in result.slice(1)" :key="index">
        <img src="./imgs/r-6.png" alt="" />
        <div>
          <div>{{ item.field_name }}</div>
          <div><span>{{ item.field_value }}</span> {{ item.unit }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { postAction, getAction } from '@/api/manage'
export default {
  data() {
    return {
      result: []
    }
  },
  async created() {
    const res = await postAction('/topic/data/listAllData/dy_dp_cycx_szyq_gk', {})
    console.log(res)
    this.result = res.result.data
  }
}
</script>

<style lang="scss" scoped>
.container {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
  .left {
    width: 148px;
    height: 242px;
    background: url('./imgs/r-4.png') no-repeat center center / 100% 100%;
    position: relative;
    & > div {
      position: absolute;
      width: 100%;
      top: 28%;
      left: 50%;
      transform: translateX(-50%);
      font-family: MicrosoftYaHei;
      font-size: 18px;
      color: #ffffff;
      font-style: normal;
      text-transform: none;
      text-align: center;
      & > div:nth-child(2) {
        font-size: 16px;
        span {
          font-family: YouSheBiaoTiHei;
          font-size: 36px;
          color: #19fdf5;
          text-align: center;
          font-style: normal;
          text-transform: none;
        }
      }
    }
    &::before {
      content: '';
      width: 156px;
      height: 120px;
      background: url('./imgs/r-5.png') no-repeat center center / 100% 100%;
      position: absolute;
      top: 30%;
      left: 50%;
      transform: translateX(-50%);
    }
  }
  .right {
    flex: 1;
    & > div {
      display: flex;
      align-items: center;
      margin: 30px 10px;
      font-family: MicrosoftYaHei;
      font-size: 18px;
      color: #ffffff;
      font-style: normal;
      text-transform: none;
      img {
        width: 51px;
        height: 48px;
        margin-right: 10px;
      }
      & > div {
        & > div:nth-child(2) {
          font-size: 14px;
          span {
            font-family: MicrosoftYaHei, MicrosoftYaHei;
            font-weight: bold;
            font-size: 20px;
            color: #ffde00;
            font-style: normal;
            text-transform: none;
          }
        }
      }
    }
  }
}
</style>
